package com.lagou;

import org.junit.Test;
import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;
import redis.clients.jedis.JedisPoolConfig;

import java.util.HashSet;

public class RedisClientTest {
    @Test
    public void simpleTest() {
        JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
        HashSet<HostAndPort> hostAndPorts = new HashSet<>();
        hostAndPorts.add(new HostAndPort("192.168.80.122",7001));
        hostAndPorts.add(new HostAndPort("192.168.80.122",7002));
        hostAndPorts.add(new HostAndPort("192.168.80.122",7003));
        hostAndPorts.add(new HostAndPort("192.168.80.122",7004));
        hostAndPorts.add(new HostAndPort("192.168.80.122",7005));
        hostAndPorts.add(new HostAndPort("192.168.80.122",7006));
        hostAndPorts.add(new HostAndPort("192.168.80.122",7007));
        hostAndPorts.add(new HostAndPort("192.168.80.122",7008));
        JedisCluster jcd = new JedisCluster(hostAndPorts, jedisPoolConfig);

        jcd.set("name:001","liubei");

        System.out.println(jcd.get("name:001"));

    }
}
